<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>若依介绍</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/layui.css}" rel="stylesheet" >
    <link rel="stylesheet" th:href="@{/editormd/css/editormd.min.css}" />
    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script type="text/javascript" th:src="@{/editormd/editormd.min.js}" ></script>
    <script th:src="@{/ruoyi/js/common.js?v=2.2.0}"></script>
    <script th:src="@{/ruoyi/js/yuyu-ui.min.js?v=2.2.0}"></script>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-user-edit">
        <div class="form-group">
            <label class="col-sm-3 control-label ">通知标题：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="title" />
            </div>
        </div>
        <div id="md-content" style="z-index: 1 !important;">
				<textarea placeholder="博客内容" name="content" style="display: none;">
				#### Disabled options

- 请输入通知内容;
			</textarea></div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="button" onclick="edit()" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    //初始化markdown编辑器
    var contentEditor;
    //提交通知编辑
    function edit() {
        var title = $("input[name='title']").val();
        var json = {
            "title" : title
        };
        $.ajax({
            cache : true,
            type : "post",
            url : "/notice/editpost/",
            data: JSON.stringify(json),
            dataType:'json',
            contentType:"application/json",
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                if (data.code==200){
                    parent.layer.msg('编辑成功', {icon: 1});
                    setTimeout(function () {
                        parent.refreshTable();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    },500);
                }
            }
        });
    }
    $(function() {
        contentEditor = editormd("md-content", {
            width   : "99%",
            height  : 550,
            syncScrolling : "single",
            path    : "/editormd/lib/"
        });

        /*
        // or
        testEditor = editormd({
            id      : "test-editormd",
            width   : "90%",
            height  : 640,
            path    : "../lib/"
        });
        */
    });
</script>
</body>
</html>